From: macman@bernina.ethz.ch (Danny Schwendener) Subject: Browsing digests for recent uploads (version 1.1) Date: Fri, 12 Feb 1993 13:57:18 GMT This is a slightly improved version of the skim Unix program recently posted by Craig Nevill-Manning . This version also inserts the necessary 'cd' and 'get' commands so that you can feed the resulting script directly into FTP. I have sumex-aim in my .netrc file, so that all I need to do after the skim is to type the following command to get the tagged files: ftp sumex-aim.stanford.edu < download Craig Nevill-Manning 's program description: > >I wrote this quick Unix program for browsing info-mac digests. I try to keep >up with the new uploads to sumex, but it's a tedious, repetitive process to >actually download the stuff I want. This C program scans a digest (or several) >in a file or files given on the command line for the [*] denoting an upload >notice, and prints out the description. Type y if you want to download it, and >it adds the path and name to a file called "download". Typing n just continues >to the next message, and q quits the program. I then rearrange the file in >emacs, inserting cd and get commands, and paste it into an ftp session. > >Hope it's useful to someone! Remember, it was only a half-hour hack; feel free >to improve on it. > >Compile with cc -o skim skim.c -lcurses -ltermcap >or take out the curses stuff if you don't have it. -- Danny Schwendener E-mail: macman@bernina.ethz.ch ezInfo Information Services, Swiss Fed. Institute of Technology (ETHZ) skim.c (version 1.1) follows: ------------------------------ cut here ------------------------------ /* skim.c Version 1.1 */ #include #include FILE *download; main(argc, argv) int argc; char **argv; { int i; initscr(); cbreak(); download = fopen("download", "a"); for (i = 1; i < argc; i ++) skim(argv[i]); nocbreak(); endwin(); } skim(filename) char *filename; { FILE *f; char s[1000], path[1000]; char *name; int ch, line; f = fopen(filename, "r"); if (f) { while (!feof(f)) { do { fgets(s, 1000, f); } while (strncmp(s, "Subject: [*]", 12) != 0 && !feof(f)); line = 0; path[0] = 0; clear(); refresh(); puts(filename); while (!feof(f)) { if (line ++ < LINES - 4) printf("%s", s); fgets(s, 1000, f); if (strncmp(s, "[Archived as", 12) == 0) { strcpy(path, &s[13]); break; } } printf("%s", s); if (path[0]) { printf("Get this? (y/n)"); do ch = getchar(); while (ch != 'y' && ch != 'n' && ch != 'q'); if (ch == 'y') { int i; for (i = strlen(path); i > 0 && path[i] != ';'; i --); /* cut off trailer */ path[i] = 0; for (i = strlen(path); i > 0 && path[i] != '/'; i --); /* split into dir path & name */ name = &path[i+1]; path[i] = 0; fprintf(download, "cd %s/\nget %s\n", path,name); } else if (ch == 'q') { fclose(download); nocbreak(); endwin(); exit(0); } } } fclose(f); } }